/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Dic_班组人员",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Order.IServices;
using VOL.Core.Utilities;
using VOL.Core.ManageUser;

namespace VOL.Order.Controllers
{
    public partial class Dic_班组人员Controller
    {
        private readonly IDic_班组人员Service _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Dic_班组人员Controller(
            IDic_班组人员Service service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        [HttpPost]
        [Route("人员所在班组")]
        public ActionResult 人员所在班组()
        {
            string 人员 = UserContext.Current.UserTrueName;
            WebResponseContent webResponse = new WebResponseContent();
            Dic_班组人员 dic班组人员 = _service.人员所在班组(人员);
            if (dic班组人员 != null)
            {
                webResponse.Code = "0";
                webResponse.OK("查询成功", dic班组人员);
            }
            else
            {
                webResponse.Code = "1";
                webResponse.OK("未查询到你的所在班组");
            }
         
            return Json(webResponse);
        }

        [HttpPost]
        [Route("随行人员")]
        public ActionResult 随行人员()
        {
            string 人员 = UserContext.Current.UserTrueName;
            WebResponseContent webResponse = new WebResponseContent();
            List<Dic_班组人员> dic班组人员 = _service.随行人员(人员);
            if (dic班组人员 != null)
            {
                webResponse.Code = "0";
                webResponse.OK("查询成功", dic班组人员);
            }
            else
            {
                webResponse.Code = "1";
                webResponse.OK("未查询到你的所在班组");
            }

            return Json(webResponse);
        }

    }
}
